package cup.league.app;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

public class LoadChampsActivity extends Activity{
	
	private LinearLayout ll;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.loadchamps);
		
		DBHandler db = new DBHandler(LoadChampsActivity.this);
		db.open();
		
		ll = (LinearLayout) findViewById(R.id.linearLayout);
		Cursor champs = db.getAllChamps();
		champs.moveToFirst();
		int i = 0;
		
		while(!champs.isAfterLast()){
			TextView t = new TextView(this);
			t.setText(champs.getString(champs.getColumnIndex(db.CHA_CL_TITLE)));
			t.setClickable(true);
			ll.addView(t,i);
			i++;
			champs.moveToNext();
		}
		
		champs.close();
		db.close();
		
		
	}

}
